<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>表单验证模块</title>
</head>
<body>
<script>
    function isValidTelephoneNumber(telephoneNumber) {
        var teleRegExp = /^(\+\d{1,3} ?)?(\(\d{1,5}\)|\d{1,5}) ?\d{3}?\{0,7}( (x|xtn|ext|extn|pax|pbx|extension)?\.? ?\d{2,5})?$/;
        return teleRegExp.test(telephoneNumber);
    }

    function isValidPostalCode(postalCode) {
        var pcodeRegExp = /^(\d{5}(-\d{4})?|([a-z][a-z]?\d\d?|[a-z]{2}\d[a-z]) ?\d[a-z][a-z])$/i;
        return pcodeRegExp.test(postalCode);
    }

    function isValidEmalil(emailAddress) {
        var emailRegExp = /^(([^<>()\[\]\\.,;:@"\x00-\x20\x7f]|\\.)+|("""([^\x0a\x0d"\\]|\\\\)+"""))@(([a-z]|#\d+?)([a-z0-9-]|#\d+?)*([a-z0-9]|#\d+?)\.)+([a-z]{2,4})$/i;
        return emailRegExp.test(emailAddress);
    }
</script>
<script>
    var phoneNumber = prompt('Please enter a phone number.', '');
    if (isValidTelephoneNumber(phoneNumber)) {
        alert('Valid Phone Number');
    } else {
        alert('Invalid Phone Number');
    }

    var postalCode = prompt('Please enter a postal code.', '');
    if (isValidPostalCode(postalCode)) {
        alert('Valid Postal Code');
    } else {
        alert('Invalid Postal Code');
    }

    var email = prompt('Please enter an email address.');
    if (isValidEmalil(email)) {
        alert('Valid Email Address');
    } else {
        alert('Invalid Email Address');
    }
</script>
</body>
</html>